<template>
  <div class="material-container">
    <div class="header">
        <div class="header-title">会议材料</div>
        <i class="close-icon" @click="closeAndSureBtn('close')"></i>
    </div>
    <div class="material-content">
        <div class="material-items" v-for="(item,index) in materialList" :key="index">
            <div class="left"><img class="left-image" :src='materialImg[item.type]' alt=""></div>
            <div class="right">
                <div class="title">{{item.title}}</div>
                <div class="right-btn">
                    <div class="btn" @click="clickDownOrCheck(item)">{{item.type ==0?"下载":"查看"}}</div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>

<script>
export default {
    props: {
        roomInfo: Object,
        videoInfo: Object
    },
    created() {
        if (this.roomInfo) {
            this.materialList = this.roomInfo.roomInfo?.roomExt2?.documentInfoList
        } else {
            this.materialList = this.videoInfo.videoInfo?.roomVideoExt2?.documentInfoList
        }
        
    },
    data() {
        return {
            materialList: [],
            materialImg: [require('@/assets/images/meetingDoc.png'), require('@/assets/images/meetingImg.png')],
            // tempList: [
            //     {
            //         title: '哈哈哈哈',
            //         link: 'https://img1.baidu.com/it/u=834894649,3086306884&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1422',
            //         type:0
            //     },
            //     {
            //         title: '哈哈哈哈',
            //         link: 'https://img1.baidu.com/it/u=834894649,3086306884&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1422',
            //         type:1
            //     },
            //     {
            //         title: '哈哈哈哈',
            //         link: 'https://img1.baidu.com/it/u=834894649,3086306884&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1422',
            //         type:1
            //     },
            // ]
        }
    },
    methods: {
        //点击关闭弹窗
        closeAndSureBtn(type) {
            this.$emit("formChildMsg", {
                type: "closeApplyInfo",
            });
        },
        //点击查看或者下载
        clickDownOrCheck(item) {
            if (item.type) {
                //如果是查看图片
               this.$emit("formChildMsg", {
                    type: "cleckMaterial",
                    dataMsg: item
                });
            } else {
                //如果是下载文件
                this.$emit("formChildMsg", {
                    type: "downloadMaterial",
                    dataMsg: item
                });
            }
        }
    }
    
}
</script>

<style lang="less" scoped>
.material-container{
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 640px;
    overflow-y: auto;
    background: #ffffff;
    z-index: 1501;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    .header{
        width: 90%;
        height: 103px;
        margin: 0 auto;
        border-bottom: 1px solid #F2F2F2;
        display: flex;
        justify-content: space-around;
        align-items: center;
        .header-title{
            width: 100px;
            height: 100%;
            flex:1;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: 500;
            font-size: 34px;
            color: #000000;
            padding-left: 40px;
        }
        .close-icon{
            width: 48px;
            height: 48px;
            background: url('../../../assets/images/report_close.png') no-repeat;
            background-size: 48px 48px;
        }
    }
    .material-content{
        width: 100%;
        height: calc(100% - 103px);
        overflow-y: scroll;
        .material-items{
            width: 100%;
            height: 200px;
            display: flex;
            .left{
                width: 130px;
                height: 144px;
                margin: 22px 22px;
                .left-image{
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }
            .right{
                margin-top: 22px;
                flex: 1;
                display: flex;
                flex-direction: column;
                width: 130px;
                height: 144px;
                .title{
                    width: 95%;
                    height: 84px;
                    line-height: 42px;
                    font-size: 30px;
                }
                .right-btn{
                    width: 95%;
                    height: calc(100% - 84px);
                    .btn{
                        width: 128px;
                        height: 60px;
                        border: 1px solid #FF3D00;
                        border-radius: 30px;
                        float: right;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        color: #FF3D00;
                        font-size: 30px;
                    }
                }
            }
        }
    }
}
</style>